<?php return['zmsun_del_tb_by_prefix'=>'CREATE PROCEDURE zmsun_del_tb_by_prefix(IN pTbDelPrefix VARCHAR(64))
label_main: BEGIN
DECLARE tmpDone BOOLEAN DEFAULT FALSE;
DECLARE tmpDelStr TEXT DEFAULT "";
DECLARE tmpStr VARCHAR(64);
DECLARE tmpDelNums INT UNSIGNED DEFAULT 0;
DECLARE pTbDelPrefix2 VARCHAR(130) DEFAULT REPLACE(REPLACE(QUOTE(pTbDelPrefix), "_", "\\_"), "%", "\\%");
DECLARE tmpCur1 CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_schema=(SELECT DATABASE())
 AND table_name LIKE CONCAT(SUBSTR(pTbDelPrefix2, 2, CHAR_LENGTH(pTbDelPrefix2) - 2), "%");
DECLARE CONTINUE HANDLER FOR NOT FOUND SET tmpDone=TRUE;

IF TRIM(pTbDelPrefix) = "" THEN leave label_main; END IF;
OPEN tmpCur1;
REPEAT
  FETCH tmpCur1 INTO tmpStr;
  IF NOT tmpDone THEN
    SET tmpDelStr = CONCAT(tmpDelStr, tmpStr, ",");
    SET tmpDelNums = tmpDelNums + 1;
  END IF;
UNTIL tmpDone END REPEAT;
CLOSE tmpCur1;
IF tmpDelStr != "" THEN
  SET FOREIGN_KEY_CHECKS = FALSE;
  SET tmpDelStr = CONCAT("DROP TABLE ", substr(tmpDelStr, 1, CHAR_LENGTH(tmpDelStr) -1), ";");
  SET @zmsun_del_tb_by_prefix_tmpDelStr2 = tmpDelStr;
  PREPARE stmt1 FROM @zmsun_del_tb_by_prefix_tmpDelStr2;
  EXECUTE stmt1;
  DEALLOCATE PREPARE stmt1;
  SET FOREIGN_KEY_CHECKS = TRUE;
END IF;
SELECT tmpDelNums AS "del_nums";
END;','zmsun_del_tb_by_name'=>'CREATE PROCEDURE zmsun_del_tb_by_name(IN tbNameStr VARCHAR(1200))
label_main: BEGIN
IF TRIM(tbNameStr) = "" THEN
 leave label_main;
END IF;
SET FOREIGN_KEY_CHECKS = FALSE;
SET @zmsun_del_tb_by_name_tbNameStr2 = CONCAT("DROP TABLE IF EXISTS ", tbNameStr, ";");
PREPARE stmt1 FROM @zmsun_del_tb_by_name_tbNameStr2;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
SET FOREIGN_KEY_CHECKS = TRUE;
END;','zmsun_get_tb_name_by_prefix'=>'CREATE PROCEDURE zmsun_get_tb_name_by_prefix(IN pTbPrefix VARCHAR(64))
BEGIN
DECLARE resStr TEXT DEFAULT "";
DECLARE tmpStr VARCHAR(64);
DECLARE tmpGetNums INT UNSIGNED DEFAULT 0;
DECLARE tmpDone BOOLEAN DEFAULT FALSE;
DECLARE pTbPrefix2 VARCHAR(130) DEFAULT REPLACE(REPLACE(QUOTE(pTbPrefix), "_", "\\_"), "%", "\\%");
DECLARE tmpCur1 CURSOR FOR SELECT table_name FROM information_schema.tables WHERE table_schema=(SELECT DATABASE())
 AND table_name LIKE CONCAT(SUBSTR(pTbPrefix2, 2, CHAR_LENGTH(pTbPrefix2) - 2), "%");
DECLARE CONTINUE HANDLER FOR NOT FOUND SET tmpDone=TRUE;

OPEN tmpCur1;
WHILE !tmpDone DO
  FETCH tmpCur1 INTO tmpStr;
  IF NOT tmpDone THEN
    SET resStr = CONCAT(resStr, tmpStr, ",");
    SET tmpGetNums = tmpGetNums + 1;
  END IF;
END WHILE;
CLOSE tmpCur1;
IF resStr != "" THEN
  SET resStr = SUBSTR(resStr, 1, CHAR_LENGTH(resStr) - 1);
ELSE
  SET resStr = \N;
END IF;
SELECT tmpGetNums AS nums, resStr AS names;
END;',];?>